package com.tbryant.test.redis.usagescenarios;

import com.tbryant.test.redis.RedisConstant;

/**
 * 消息消费者
 * @auther TBryant
 * @date 2021/5/26 16:40
 */
public class DelayQueueTestConsumer {
    public static void main(String[] args) {
        while (true) {
            String message = DelayQueue.getMessage(RedisConstant.REDIS_TEST_ZSET_KEY);
            if (null == message) {
                // 如果暂时没有消息，等一秒再取
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            } else {
                System.out.println("process:" + message);
            }
        }
    }
}
